<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>部门信息列表</title>
    <%--引入bootstrap样式--%>
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/department.css" rel="stylesheet">
    <script src="../js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/jquery-3.6.0.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/department.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<!-- 向后台请求员工数据 -->
<jsp:include page="/branch/departmentServlet"></jsp:include>
<div class="container">
    <div class="row">
        <div class="col-sm-12">
            <div class="heading"><strong>部门详情列表</strong></div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <a class="btn btn-primary" href="addDepartment.jsp" role="button">新增部门</a>
        </div>
    </div>
    <table class="table table-hover">
        <thead>
        <tr>
            <th scope="col">部门编号</th>
            <th scope="col">部门名称</th>
            <th scope="col">所属机构</th>
            <th scope="col">电话</th>
            <th scope="col">备注</th>
            <th scope="col">操作1</th>
            <th scope="col">操作2</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${departmentList}" var="item">
            <tr>
                <th scope="row">${item.departId}</th>
                <td class="col-sm-3">${item.departName}</td>
                <td class="col-sm-2">${item.branch.branchName}</td>
                <td class="col-sm-2">${item.phone}</td>
                <td class="col-sm-3">${item.remark}</td>

                <td class="col-sm-1"><a class="btn btn-outline-primary" role="button" href="${pageContext.request.contextPath}/departmentServlet?departId=${item.departId}">编辑</a></td>
                <td class="col-sm-1"><button type="button" class="btn btn-outline-danger department-delete" onclick="javascript:delDepartment(${item.departId});">删除</button></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
</body>
</html>
